#if !defined(SM__CHARACTER_H)
#define SM__CHARACTER_H

#include "swagme.h"
#include "TouchableObject.h"

class Sprite;

#define FRAMES_PER_ANIM 3
//#define CHARACTER_DEFAULT_SPEED 3

class Character : public TouchableObject {
  public:
    Character(Sprite* ps, int x, int y, double unitsPerMs);
    void Init(Sprite* ps, int x, int y, double unitsPerMs);
    Character(Sprite* ps);
    Character();
    ~Character();
    int Draw(SDL_Surface *dst, bool bShadow=false);
    int AddEffect(const string &name);
    int RemoveEffect(const string &name);

    // facing getter/setter
    void SetFacing(sm_direction f);
    sm_direction GetFacing() const;

    // speed getter/setter
    void SetSpeed(double newSpeed);
    double GetSpeed() const;

    Sprite *mpSprite;
    double mUnitsPerMs;

    void updatePrevPos();
    void move(double newLeft, double newTop);
  private:
    sm_direction Facing;
    sm_direction prevFacing;
    char *SpriteImageFile; // image file to load sprite surface from
    static const int FrameCount;
    int FrameCounter;

    double prevX;
    double prevY; // last coords of player
};

#endif // SM__CHARACTER_H
